home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wtj007.zip / BLOOM.ZIP / PAINTBM.C < prev    next >
Text File  |  1992-07-24  |  640b  |  27 lines

  1. // sample function
  2.  
  3. BOOL PaintBitmap (HWND hCtrl,HBITMAP hBM)
  4.   {
  5.   HDC     hDCBits, hDC;
  6.   BITMAP  bm;
  7.   BOOL    ok;
  8.   RECT    rect;
  9.   WORD   controlID;
  10.  
  11.   controlID = GetWindowWord(hCtrl, GWW_ID);
  12.   GetClientRect(hCtrl, &rect);
  13.   UpdateWindow(hCtrl);
  14.   hDC = GetDC(hCtrl);
  15.  
  16.   GetClientRect(hCtrl,&rect);
  17.   hDCBits = CreateCompatibleDC(hDC);
  18.   GetObject(hBM, sizeof(BITMAP), (LPSTR)&bm);
  19.   SelectObject(hDCBits, hBM);
  20.   ok = StretchBlt(hDC, 0, 0, rect.right,
  21.              rect.bottom, hDCBits, 0, 0, bm.bmWidth,
  22.              bm.bmHeight, SRCCOPY);
  23.   DeleteDC(hDCBits);
  24.   ReleaseDC(hCtrl, hDC);
  25.   return(ok);
  26.   }
  27.